
// 在left的原型通过Object.getPrototypeOf一直往上找，找到了就为true，找不到就为false
function myInstanceof1(left, right) {
  if (!left || !Object.getPrototypeOf(left)) return false;
  let r = right.prototype;

  let proto = Object.getPrototypeOf(left);
  while (proto !== null) {
    if (proto === r) {
      return true;
    }
    proto = Object.getPrototypeOf(proto);
  }
  return false;
}


// Expected output: true
console.log(myInstanceof1([1, 2, 3], Array));
// console.log(isNaN("ss"), Number.isNaN("sss"));
// console.log(Object.prototype.toString());
